<template>
	<div class="notices">
		<v-Header :item="headerMess"></v-Header>
		<div v-for="(i,index) in lists" @click="sendParams(i.id)" :value="i.id">
			 <div class="content">
		    	<span class="name">{{i.title}}</span>
		        <span class="time">{{i.createTime}}</span>
		    </div>
		</div>
		<div class="footer" v-show="lists.length==0">
				<img src="../../assets/default_record.png"/>
				<p>暂无内容</p>
		</div>
	</div>
</template>

<script>
	import NoticesArrowList from '@/components/NoticesArrowList'
	import my from '@/api/my/index'
	import { toast } from '@/util/index'
	import Header from '@/components/Header'
	export default{
		data(){
			return{
				lists:[],
				msg: '父组件传递参数',
				headerMess:{
			        src:require("../../assets/nav_back.png"),
			        headerText: '公告信息',
			        right: ''
			    },
			}
		},
		components: {
	        'v-NoticesArrowList': NoticesArrowList,
	        "v-Header":Header,
    	},
		methods:{
			sendParams (num) {
		        this.$router.push({
		            path: '/noticesDetail/', 
		            name: 'noticesDetail',
		            query: { 
		                id: num
		            }
		           
		        })
		    }
			
		},
		beforeMount(){
			let senddata = {
				userId:window.localStorage.getItem("token"),
				plat:"mlj"
			}
		
			my.noticeList(senddata).then((res) => {
				if (res.data.code == 200) {
					this.lists=res.data.data;
				}else if(res.data.code==222){
		            this.$router.push({path:'/login'})
		        }else {
					toast(res.data.message)
				}
			})
			
			
			
		},
		 beforeRouteEnter(to,from,next){
		    document.querySelector('title').innerText='谋略家'
		      next()
		  }
	}
</script>

<style lang="less" scoped>
@import '../../less/config.less';
.header{
	padding:0 @p30;
	display: flex;
	justify-content:space-between;
	align-items: center;
	height:@hwrap;
	color:#fff;
	font-size:.48rem;
	img,.img{
		width: 30px;
		height: 30px;
	}
}
div{
	.content {
    height: 2rem;
    font-size: @f32;
    display: flex;
    justify-content: center;
   	align-items: space-between;
    flex-direction: column;
    background-color: @liBg;
    margin: @fsize @p30;
    padding:0 @f28;
    border-radius: 0.13333rem;
    .name{
    	font-size: @f28;
    	color: white;
    }
    
    .time{
    	font-size: @f24;
    	color: #56627C;
    	margin-top: @f28;
    }
    
}
}
.footer{
	text-align: center;
	color: @Color;
	font-size: @f28;
	margin-top: 4rem;
	margin-top: 2.5rem;
		display: flex;
		color: #0296af;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		p{
			color: #0296af;
		}
}
</style>